----------- CALLBACK SETTINGS ----------
delete TERMINOLOGY where ID='82DE550D-59A4-474A-84DA-39CF09A53FA9'
GO   
         
INSERT INTO [dbo].[TERMINOLOGY] (ID,[MODULE_NAME],[NAME],[DISPLAY_NAME],[LANG],[DELETED],[DATE_ENTERED],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[LIST_NAME],LIST_ORDER)
VALUES ('82DE550D-59A4-474A-84DA-39CF09A53FA9','Callback','LBL_CALLBACK','Callback','en-US',0,getdate(),getdate(),getdate(),null,50)
GO 

---------------------------------------------------------
---------Callback Settings: LISTVIEW---------------------
DELETE [dbo].[GRIDVIEWS] WHERE NAME='Callback.SettingListView'
INSERT INTO [dbo].[GRIDVIEWS]([ID], [DELETED], [CREATED_BY], [DATE_ENTERED], [MODIFIED_USER_ID], [DATE_MODIFIED], [DATE_MODIFIED_UTC], [NAME], [MODULE_NAME], [VIEW_NAME], [PRE_LOAD_EVENT_ID], [POST_LOAD_EVENT_ID])
SELECT N'5BFDAF10-EEDD-4883-A6CB-BDACB031BF5D', 0, NULL, getdate(), N'00000000-0000-0000-0000-000000000001', getdate(), getdate(), N'Callback.SettingListView', N'Callback', N'vwCallback_Settings_List', NULL, NULL
GO
delete [dbo].[GRIDVIEWS_COLUMNS] where grid_name='Callback.SettingListView'
go
INSERT INTO [dbo].[GRIDVIEWS_COLUMNS]([ID], [DELETED], [CREATED_BY], [DATE_ENTERED], [MODIFIED_USER_ID], [DATE_MODIFIED], [DATE_MODIFIED_UTC], [GRID_NAME], [COLUMN_INDEX], [COLUMN_TYPE], [DEFAULT_VIEW], [HEADER_TEXT], [SORT_EXPRESSION], [ITEMSTYLE_WIDTH], [ITEMSTYLE_CSSCLASS], [ITEMSTYLE_HORIZONTAL_ALIGN], [ITEMSTYLE_VERTICAL_ALIGN], [ITEMSTYLE_WRAP], [DATA_FIELD], [DATA_FORMAT], [URL_FIELD], [URL_FORMAT], [URL_TARGET], [LIST_NAME], [URL_MODULE], [URL_ASSIGNED_FIELD], [MODULE_TYPE], [PARENT_FIELD])
SELECT newid(), 0, NULL, getdate(), NULL, getdate(),getdate(), N'Callback.SettingListView', 3, N'TemplateColumn', 0, N'Callback.LNK_CALLBACK_SETTING_LIST_Title', N'Name', N'10%', N'listViewTdLinkS1', NULL, NULL, 1		, N'Name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL UNION ALL
SELECT newid(), 0, NULL, getdate(), NULL, getdate(),getdate(), N'Callback.SettingListView',12, N'TemplateColumn', 0, N'Callback.LNK_CALLBACK_SETTING_LIST_Value', N'Value', N'10%', N'listViewTdLinkS1', NULL, NULL, 1		, N'Value', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL UNION ALL
SELECT newid(), 0, NULL, getdate(), NULL, getdate(),getdate(), N'Callback.SettingListView',12, N'TemplateColumn', 0, N'Callback.LNK_CALLBACK_SETTING_LIST_Description', N'Description', N'10%', N'listViewTdLinkS1', NULL, NULL, 1		, N'Description', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL 
GO 
delete TERMINOLOGY where ID='F5BDFE19-271C-46F8-BF39-8B112308B079'
GO            
INSERT INTO [dbo].[TERMINOLOGY] (ID,[MODULE_NAME],[NAME],[DISPLAY_NAME],[LANG],[DELETED],[DATE_ENTERED],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[LIST_NAME],LIST_ORDER)
VALUES ('F5BDFE19-271C-46F8-BF39-8B112308B079','Callback','LBL_SETTINGS_LIST_FORM_TITLE','Callback Setting List','en-US',0,getdate(),getdate(),getdate(),null,50)

GO   
delete TERMINOLOGY where ID='D02792B5-017A-4658-8AB5-C4755933A9BE'
GO   
delete TERMINOLOGY where ID='0708F19A-C0F7-4882-840C-C9B45535321D'
GO   
delete TERMINOLOGY where ID='88DED0EC-F0C1-42A4-BB30-39930BF52803'
GO   
INSERT INTO [dbo].[TERMINOLOGY] (ID,[MODULE_NAME],[NAME],[DISPLAY_NAME],[LANG],[DELETED],[DATE_ENTERED],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[LIST_NAME],LIST_ORDER)
VALUES ('D02792B5-017A-4658-8AB5-C4755933A9BE','Callback','LNK_CALLBACK_SETTING_LIST_Title','Name','en-US',0,getdate(),getdate(),getdate(),null,50)

GO   
INSERT INTO [dbo].[TERMINOLOGY] (ID,[MODULE_NAME],[NAME],[DISPLAY_NAME],[LANG],[DELETED],[DATE_ENTERED],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[LIST_NAME],LIST_ORDER)
VALUES ('0708F19A-C0F7-4882-840C-C9B45535321D','Callback','LNK_CALLBACK_SETTING_LIST_Value','Value','en-US',0,getdate(),getdate(),getdate(),null,50)

GO   
INSERT INTO [dbo].[TERMINOLOGY] (ID,[MODULE_NAME],[NAME],[DISPLAY_NAME],[LANG],[DELETED],[DATE_ENTERED],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[LIST_NAME],LIST_ORDER)
VALUES ('88DED0EC-F0C1-42A4-BB30-39930BF52803','Callback','LNK_CALLBACK_SETTING_LIST_Description','Description','en-US',0,getdate(),getdate(),getdate(),null,50)
GO 

------------------- DATABASE-VIEW: LIST VIEW  ---------------
if (object_id('vwCallback_Settings_List') is not null)
drop view [dbo].[vwCallback_Settings_List]
go
CREATE VIEW [dbo].[vwCallback_Settings_List]
AS
SELECT [ID]
      ,[Name]
      ,[Value]
      ,[DefaultValue]
      ,[Description]
      ,[Section]
  FROM [dbo].[CallbackSettings]
go

---------------------------------------------------------
---------Callback Settings: Edit View ---------------------
delete [EDITVIEWS] where id='F9F8C3A1-409E-4781-96B6-AF4D84805A39'
go
INSERT INTO [dbo].[EDITVIEWS]
           ([ID]
           ,[DELETED]
           ,[CREATED_BY]
           ,[DATE_ENTERED]
           ,[MODIFIED_USER_ID]
           ,[DATE_MODIFIED]
           ,[DATE_MODIFIED_UTC]
           ,[NAME]
           ,[MODULE_NAME]
           ,[VIEW_NAME]
           ,[LABEL_WIDTH]
           ,[FIELD_WIDTH]
           ,[DATA_COLUMNS])
     VALUES
           ('F9F8C3A1-409E-4781-96B6-AF4D84805A39'
           ,0
           ,null
           ,getdate()
           ,null
           ,getdate()
           ,getdate()
           ,'Callback.EditSetting'
           ,'Callback'
           ,'vwCallback_Settings_List'
           ,'10%'
           ,'70%'
           ,1)
GO
delete EDITVIEWS_FIELDS where edit_name='Callback.EditSetting'
go
INSERT INTO [dbo].[EDITVIEWS_FIELDS]([ID],[DELETED],[DATE_ENTERED],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[EDIT_NAME],[FIELD_INDEX],[FIELD_TYPE],[DEFAULT_VIEW],[DATA_LABEL],[DATA_FIELD],[DATA_FORMAT],[DISPLAY_FIELD],[DATA_REQUIRED],[UI_REQUIRED],[FORMAT_TAB_INDEX],[FORMAT_MAX_LENGTH],[FORMAT_SIZE],[FORMAT_ROWS],[FORMAT_COLUMNS],[COLSPAN],[ROWSPAN],[FIELD_VALIDATOR_ID],[FIELD_VALIDATOR_MESSAGE],[MODULE_TYPE],[TOOL_TIP])
VALUES (newid(),0,getdate(),getdate(),getdate(),'Callback.EditSetting',1,'Label',0,'Callback.LNK_CALLBACK_SETTING_LIST_Title','Name',null,null,0,0,1,null,null,null,null,null,null,null,null,null,null)
GO
INSERT INTO [dbo].[EDITVIEWS_FIELDS]([ID],[DELETED],[DATE_ENTERED],[DATE_MODIFIED],[DATE_MODIFIED_UTC],[EDIT_NAME],[FIELD_INDEX],[FIELD_TYPE],[DEFAULT_VIEW],[DATA_LABEL],[DATA_FIELD],[DATA_FORMAT],[DISPLAY_FIELD],[DATA_REQUIRED],[UI_REQUIRED],[FORMAT_TAB_INDEX],[FORMAT_MAX_LENGTH],[FORMAT_SIZE],[FORMAT_ROWS],[FORMAT_COLUMNS],[COLSPAN],[ROWSPAN],[FIELD_VALIDATOR_ID],[FIELD_VALIDATOR_MESSAGE],[MODULE_TYPE],[TOOL_TIP])
VALUES(newid(),0,getdate(),getdate(),getdate(),'Callback.EditSetting',2,'Textbox',0,'Callback.LNK_CALLBACK_SETTING_LIST_Value','Value',null,null,0,0,1,null,null,null,null,null,null,null,null,null,null)
GO

------------------- DATABASE: LIST VIEW  ---------------
if (object_id('vwCallback_Settings_Edit') is not null)
drop view [dbo].vwCallback_Settings_Edit
go
CREATE VIEW [dbo].vwCallback_Settings_Edit
AS
SELECT [ID]
      ,[Name]
      ,[Value]
      ,[Description]
  FROM [dbo].[CallbackSettings]
go
---------------------------------
if (object_id('spCALLBACK_Settings_Update') is not null)
drop Procedure [dbo].[spCALLBACK_Settings_Update]
go
Create Procedure [dbo].[spCALLBACK_Settings_Update]
	( @ID                           uniqueidentifier output
	, @Value             nvarchar(500))
as
BEGIN
update CallbackSettings
set Value=@Value
where ID=@ID
END